package com.dunhor.scala

class HelloScala {

}

object HelloScala{
  def hello(name:String):String = {
    "Hello " + name
  }

  def hellScala(): Unit ={
    println("Hello Scala, this is rocky!")
  }

  def add = (x:Int,y:Int) => x+y

  val sum = (x:Int,y:Int) => x+y

  def sum2(x:Int)(y:Int) = x + y

  def variableParameter(s : String*): Unit ={
    s.foreach(x => println(x))
  }

  def helloDefault(name:String = "www.sparkinchain.com") : String ={
    "Hello " + name
  }

  def main(args: Array[String]): Unit = {
//    println("Hello Scala!!!")
//    print(hello("scala"))
//    hellScala()
//    print(add(1,2))
//    print(sum(1,2))
//    print(sum2(1)(2))
//    variableParameter("I","Love","Spark")
//    println(helloDefault())

//    val max = 1
//    val result = if(max > 0) 1 else 0
//    println(result)

//    var (n,r) = (10,0)
//    while (n > 0){
//      r = r + n
//      n = n - 1
//    }
//    println(r)

//    for(i <- 1 to 10){
//      println(i)
//    }
    for(i <- 1 until 10){
      println(i)
    }
  }
}
